<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RegistManager
 *
 * @author G011C1102
 */
class RegistManager {

	public function __construct() {
		require_once './../php_class/DBManager.php';
		require_once './../php_class/Security.php';
	}

	//true: useable name
	public function checkAccountName($name) {
		DBManager::init();
		$db = DBManager::$db;
		$stt = $db->prepare('SELECT account_id FROM user WHERE account_id = :name');
		$stt->bindValue(':name', $name);
		$stt->execute();
		$getName = $stt->fetch();

		$boo = null;
		if ($getName['account_id'] !== null) 
			$boo = false;
		else
			$boo = true;
		
		return $boo;
	}
	public function doRegist($account_id, $mail, $pass){
//		if($this->checkAccountName($account_id)){
//			return false;
//		}

		DBManager::init();
		$db = new DBManager();
		return $db->registerUser($account_id, $mail, $pass);
	}

}

?>
